<!--
 * @Author: 王鹏 2911783749@qq.com
 * @Date: 2022-10-25 09:01:12
 * @LastEditors: 王鹏 2911783749@qq.com
 * @LastEditTime: 2022-10-25 11:50:44
 * @FilePath: \v_shop\code\src\components\children\Rights.vue
 * @Description: 权限列表
-->
<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片 -->
    <el-card>
      <!-- 表格 -->
      <el-table
        :data="rightsList"
        max-height="450px">
        <el-table-column
          label="#"
          type="index"
          >
        </el-table-column>
        <el-table-column
          prop="anthname"
          label="权限名称"
          >
        </el-table-column>
        <el-table-column
          prop="path"
          label="路径">
        </el-table-column>
        <el-table-column
          prop="level"
          label="权限等级">
          <template slot-scope="scope">
            <el-tag type="primary" v-if="scope.row.level=='0'">一级</el-tag>
            <el-tag type="success" v-else-if="scope.row.level=='1'">二级</el-tag>
            <el-tag type="warning" v-else>三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import {get_rightsList} from '../../http/api'
export default {
  name:'Rights',
  data () {
    return {
      rightsList:[]
    };
  },

  components: {},

  computed: {},

  mounted(){
    this.getRightsList()
  },

  methods:{
    // 获取权限列表数据
    getRightsList(){
      get_rightsList().then(res=>{
        console.log(res);
        if(res.data.meta.status!=200){
          return this.$message.error(res.data.meta.msg)
        }
        this.rightsList=res.data.data
      })
    }
  },
  watch: {},
  mixins: []
}

</script>
<style  scoped>
.el-card{
  margin-top: 20px;
}
</style>